home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / µSim 1.0.5 / FabLibsƒ / CursorBalloon.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-17  |  3.0 KB  |  98 lines  |  [TEXT/CWIE]

  1. #ifndef __FABCURSORBALLOON__
  2. #define __FABCURSORBALLOON__
  3.  
  4. /* this distinguishes a normal window from a window with objects */
  5.  
  6. enum windowclasses {
  7. kFabWindowClass = 10
  8. };
  9.  
  10. /* this is my window record, containing the standard Dialog Manager record,
  11. the procedures normally called when handling events (if you do not want to
  12. undertake special actions i.e. for dragging, pass nil), the number of
  13. objects, and a Handle to the objects */
  14.  
  15. typedef struct RgnBalloonCurs RgnBalloonCurs;
  16. typedef RgnBalloonCurs *RgnBalloonCursPtr;
  17. typedef RgnBalloonCursPtr *RgnBalloonCursHandle;
  18.  
  19. struct FabWindowRec {
  20.     void (*activateProc)(EventRecord *, WindowRef, Boolean);
  21.     void (*updateProc)(WindowRef);
  22.     void (*dragProc)(WindowRef);
  23.     void (*growProc)(WindowRef, EventRecord *);
  24.     void (*zoomProc)(WindowRef);
  25.     void (*goAwayProc)(WindowRef);
  26.     void (*contentProc)(WindowRef, EventRecord *);
  27.     void (*getDragHiliteRectProc)(WindowRef, RectPtr);
  28.     Boolean (*canIAcceptDrag)(const HFSFlavor *);
  29.     OSErr (*dragReaction)(WindowRef, const HFSFlavor *);
  30.     unsigned long    objCount;
  31.     DragTrackingHandlerUPP    trackUPP;
  32.     DragReceiveHandlerUPP    recUPP;
  33.     RgnBalloonCursHandle    myZones;
  34.     };
  35.  
  36. typedef struct FabWindowRec FabWindowRec;
  37. typedef FabWindowRec *FabWindowPtr;
  38.  
  39. /* this is a generic object belonging to a window */
  40.  
  41. struct RgnBalloonCurs {
  42.     void (*recalcRgnProc)(DialogRef, RgnBalloonCursPtr);
  43.     RgnHandle    zoneLocal;
  44.     RgnHandle    zoneGlobal;
  45.     CursHandle    curs;
  46.     unsigned long    myBalloon;
  47.     short        balloonVariant;
  48.     short        itemID;
  49.     };
  50.  
  51. #pragma internal on
  52. //==========================================================
  53.  
  54. OSErr InstallRgnHandler(FabWindowPtr w, RgnHandle whichRgn, void (*recalcProc)(DialogRef, RgnBalloonCursPtr),
  55.                         CursHandle cursor,
  56.                         unsigned long balloon, short ballnVariant, short iID);
  57. void RecalcMouseRegion(DialogRef d, Point mouse);
  58. FabWindowPtr ResizeObjects(DialogRef w);
  59. void RecalcGlobalCoords(FabWindowPtr w);
  60. //void DisposFabWindow(FabWindowPtr w);
  61. void ForceMouseMovedEvent(void);
  62. //void InitFabWindow(FabWindowPtr w);
  63.  
  64. //==========================================================
  65.  
  66. extern RgnHandle    mouseRgn, wideOpenRgn;
  67.  
  68. //==========================================================
  69. #pragma internal reset
  70.  
  71. /* useful macros */
  72.  
  73. #define toBalloon(m, i)        (((long)m << 16) + i)
  74.  
  75. #define Zones(w)            (w->myZones)
  76.  
  77. /* macros for setting the event handlers for the window, and
  78. prototypes of the handlers */
  79.  
  80. #define SetActivate(w, p)    w->activateProc = p
  81. #define SetUpdate(w, p)        w->updateProc = p
  82. #define SetDrag(w, p)        w->dragProc = p
  83. #define SetGrow(w, p)        w->growProc = p
  84. #define SetZoom(w, p)        w->zoomProc = p
  85. #define SetGoAway(w, p)        w->goAwayProc = p
  86. #define SetContent(w, p)    w->contentProc = p
  87. #define SetGetDragRect(w, p)    w->getDragHiliteRectProc = p
  88. #define SetCanIAcceptDrag(w, p)    w->canIAcceptDrag = p
  89. #define SetDragReaction(w, p)    w->dragReaction = p
  90.  
  91. #define NumObjects(w)        (w->objCount)
  92. #define OneMoreObject(w)    (w->objCount++)
  93.  
  94. //#define IsFabWindow(w)        (w && (GetWindowKind(w.u.w) == kFabWindowClass || (isMovableModal(w))))
  95.  
  96. #endif
  97.  
  98.